<!DOCTYPE html>
<html>
<meta charset="UTF-8">

<head>
    <title>条件渲染</title>
    <script type="text/javascript" , src="../js/vue.js">

    </script>
</head>

<body>
    <div id="root">
        <button @click="vshMethod">奇幻</button>
        <h2 v-show="vShow">你看诺克萨斯</h2>
        <!-- v-show 隐藏f 显示t -->
        <!-- v-if v-else if 直接干掉结构 -->
        <!-- 不用重新加载 类似缓存 -->
        <template v-if="n%2===0"> h2有的 n==1</template>  
    </div>

    <script type="text/javascript">
        Vue.config.productionTip = false
        new Vue({
            el: '#root',
            data() {
                return {
                    vShow: true,
                    n: 0
                }
            },
            methods: {
                vshMethod() {
                    this.vShow = !this.vShow
                    this.n++
                }
            },
        })
    </script>
</body>

</html>